import request from '@/utils/request.js'

//调用注册接口函数
export const userRegisterService = (registerData)=>{
    //借助UrlSearchParams
    return request.post('/user/register',registerData);
}

//调用登录接口函数
export const userLoginService = (loginData) => {
    const params = new URLSearchParams();
    for(let key in loginData){
        params.append(key,loginData[key])
    }
    return request.post('/user/login',params)
}

//获取用户详细信息
export const userInfoService = () => {
    return request.get('/user/userInfo')
}

//更新用户信息
export const updateUserInfoService = (data) => {
    
    return request.put('/user/update',data);
}

//更新密码
export const updatePasswordService = (data)=> {
    const params = new URLSearchParams();
    for(let key in data){
        params.append(key,data[key])
    }
    return request.put('/user/updatePwd',params)
}